package org.reyton.dao.impl;

import org.hibernate.SessionFactory;
import org.reyton.dao.BizClaimVoucherDetailDao;
import org.reyton.entity.BizClaimVoucher;
import org.reyton.entity.BizClaimVoucherDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.hibernate4.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

/**
 * 报销单明细表Dao实现类
 * Created by reyton on 16-12-1.
 */
@Repository("bizClaimVoucherDetailDao")
public class BizClaimVoucherDetailDaoImpl extends HibernateDaoSupport implements BizClaimVoucherDetailDao {
    @Autowired
    @Qualifier("sessionFactory")
    public void setSuperSessionFactory(SessionFactory sessionFactory) {
        super.setSessionFactory(sessionFactory);
    }

    @Override
    public Serializable save(BizClaimVoucherDetail bizClaimVoucherDetail) {
        return this.getHibernateTemplate().save(bizClaimVoucherDetail);
    }

    @Override
    public List<BizClaimVoucherDetail> find(BizClaimVoucher bizClaimVoucher) {
        return (List<BizClaimVoucherDetail>)this.getHibernateTemplate().
                find("from BizClaimVoucherDetail where bizClaimVoucher = ? ",bizClaimVoucher );
    }

    @Override
    public void delete(BizClaimVoucherDetail bizClaimVoucherDetail) {
        this.getHibernateTemplate().delete(bizClaimVoucherDetail);
    }

    @Override
    public void update(BizClaimVoucherDetail bizClaimVoucherDetail) {
        this.getHibernateTemplate().update(bizClaimVoucherDetail);
    }
}
